<template>
  <div class="login">
    <div class="login-form">
      <el-form ref="form" :model="form" label-width="0px" v-loading="loading">
        <el-form-item>
          <h4>Portal-Demo</h4>
        </el-form-item>
        <el-form-item>
          <el-input
            maxlength="11"
            v-model="form.account"
            placeholder="请输入账号"
          ></el-input>
        </el-form-item>

        <el-form-item>
          <el-input
            maxlength="20"
            type="password"
            v-model="form.pwd"
            placeholder="请输入密码"
          ></el-input>
        </el-form-item>
        <el-button class="btn" type="primary" @click="onSubmit">登录</el-button>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {
        account: "",
        pwd: "",
      },
      loading: false,
    };
  },

  methods: {
    onSubmit() {
      this.loading = true;
      setTimeout(() => {
        this.loading = false;
        this.$root.token = "11111222222";
        this.$router.replace("/home/work");
      }, 1000);
    },
  },
};
</script>
<style lang="less" scoped>
.login {
  width: 100%;
  height: 100%;
  background: url("../assets/img/login_bg.svg");
  display: flex;
  flex-direction: column;
  align-items: center;

  h4 {
    text-align: center;
    color: #0779e4;
    font-weight: 600;
    font-size: 28px;
  }

  .login-form {
    width: 400px;
    padding: 20px;
    margin-top: 120px;
    border-radius: 4px;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  }
  .btn {
    width: 100%;
  }
}
</style>
